package com.om.common;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.om.base.AuthorizationCache;
import com.om.base.BaseConnectionManage;
import com.om.base.BeanFactory;

public class InitListener implements ServletContextListener {

	private String connectionManageClassName="";
	private String beanFactoryClassName="";
	private String authorizationCacheClassName="";
	
	
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
	}

	
	public void contextInitialized(ServletContextEvent sec) {
		try {
			connectionManageClassName = sec.getServletContext().getInitParameter("ConnectionManageClass");
			beanFactoryClassName = sec.getServletContext().getInitParameter("BeanFactoryClass");
			authorizationCacheClassName = sec.getServletContext().getInitParameter("AuthorizationCacheClass");
			
			BaseConnectionManage.ConnectionManageClass = Class.forName(connectionManageClassName);
			BeanFactory.BeanFactoryClass =  Class.forName(beanFactoryClassName);
			AuthorizationCache.AuthorizationCacheClass = Class.forName(authorizationCacheClassName);
			
		} catch (Exception ex) {
			ex.printStackTrace();
		}

	}

}
